<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateLotteryAwardsTable extends Migration
{
    /**
     * Run the migrations.
     */
    public function up()
    {
        Schema::create('lottery_awards', function (Blueprint $table) {
            $table->id();
            $table->timestamps();
            $table->bigInteger('lottery_id')->index()->comment('活动iD');
            $table->string('name', 16)->comment('奖品名称');
            $table->string('logo_url', 256)->comment('LOGO图片链接');
            $table->string('type', 16)->comment('奖品类型');
            $table->bigInteger('refer_id')->comment('奖品对应的实体关联的ID');
            $table->tinyInteger('level')->comment('奖品等级');
            $table->integer('amount')->comment('奖品数量');
            $table->integer('draw_count')->default(0)->comment('已抽中数量');
            $table->float('rate')->comment('中奖概率');
            $table->integer('user_limit')->comment('每个用户可中奖次数');
            $table->longText('description')->comment('奖品描述');
        });
    }

    /**
     * Reverse the migrations.
     */
    public function down()
    {
        Schema::dropIfExists('lottery_awards');
    }
}
